<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Embedded Streamlit App</title>
    <style>
        body, html {
            margin: 0;
            padding: 0;
            height: 100%;
            font-family: Arial, sans-serif;
        }
        .chat-button {
            position: fixed;
            bottom: 20px;
            right: 20px;
            width: 60px;
            height: 60px;
            border-radius: 50%;
            background-color: #0078d4;
            color: white;
            display: flex;
            justify-content: center;
            align-items: center;
            cursor: pointer;
            box-shadow: 0 2px 10px rgba(0,0,0,0.2);
            transition: transform 0.3s ease;
        }
        .chat-button:hover {
            transform: scale(1.1);
        }
        .chat-window {
            position: fixed;
            bottom: -450px; /* Start off-screen */
            right: 20px;
            width: 350px;
            height: 450px;
            background-color: white;
            border-radius: 10px;
            box-shadow: 0 5px 15px rgba(0,0,0,0.2);
            overflow: hidden;
            transition: bottom 0.5s ease-out, opacity 0.5s ease-out;
            opacity: 0;
        }
        .chat-window.open {
            bottom: 100px;
            opacity: 1;
        }
        iframe {
            width: 100%;
            height: 100%;
            border: none;
        }
        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }
    </style>
</head>
<body>
    <div class="chat-button" id="chatButton">Chat</div>
    <div class="chat-window" id="chatWindow">
        <iframe src="https://rag-noah.streamlit.app/?embed=true&embed_options=show_colored_line
        " allowfullscreen></iframe>
    </div>

    <script>
        const chatButton = document.getElementById('chatButton');
        const chatWindow = document.getElementById('chatWindow');
        let isOpen = false;

        chatButton.addEventListener('click', () => {
            isOpen = !isOpen;
            if (isOpen) {
                chatWindow.classList.add('open');
                chatButton.style.animation = 'fadeIn 0.5s';
            } else {
                chatWindow.classList.remove('open');
                chatButton.style.animation = '';
            }
        });
    </script>
</body>
</html>